<%@ page import="vy.org.app.common.*" %>
<%@ page import="org.vy.dal.dao.VyEmployeeDO" %>
<%@ page import="java.util.*" %>

<%!
	private static final String EMPTY = "&nbsp;";
	private UserCtx m_user;
%>

<%
	ResourceBundle RESOURCE = ResourceBundle.getBundle("LabelResource",ActionCtx.ctx().getLocale());

	m_user = ActionCtx.ctx(request).getUser();
  	List<VyEmployeeDO> results = (List<VyEmployeeDO>)request.getAttribute(AppConstants.RESULT);
  	boolean canAdd = m_user.hasAccessToModule(ModuleEnum.ADD_EMPLOYEE.getId().toString());
  	boolean canDelete = m_user.hasAccessToModule(ModuleEnum.DELETE_EMPLOYEE.getId().toString());
  	boolean canEdit = m_user.hasAccessToModule(ModuleEnum.EDIT_EMPLOYEE.getId().toString());
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
	<link rel="stylesheet" type="text/css" href="./css/Common.css">
	<script type="text/javascript" src="./scripts/Common.js"></script>
</head> 
<body> 
<form name="mntnEmployeeForm" id="mntnEmployeeForm" method=post Action="./mntnemployee.do">
  <input type="hidden" name="mode" id="mode" value="SEARCH">
  <input type="hidden" name="lang" id="lang" value="<%=ActionCtx.ctx().getLang() %>">
  <table class="qry" width="100%" border="0" cellspacing="1" cellpadding="0">
    <tr>
      <td width="3px"></td>
      <td><center><img src="./pages/image_gif/mf1.gif" width="861" height="48"></center></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td style="text-align:right;width:850px;">
      	<a id="kruti" class="alang" href="javascript:;"><%=RESOURCE.getString(AppConstants.Languages.KRUTI) %></a>
      	<a id="hindi" class="alang" href="javascript:;"><%=RESOURCE.getString(AppConstants.Languages.HINDI) %></a>
      	<a id="english" class="alang" href="javascript:;"><%=RESOURCE.getString(AppConstants.Languages.ENGLISH) %></a>
      </td>
      <td></td>
    </tr>
    <tr>
      <td align="right" valign="middle" width="3" ></td>
      <td width="850px"  align="left" valign="top">
      	<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
          <tr>
            <td height="24" colspan="4">
            	<table width="100%" border="0" cellpadding="0" cellspacing="0">
            	<tr>
              		<td height="22"><img src="./pages/image_gif/search_mem.gif" alt="" name="off_add" width="861" height="22" border="0" ></td>
              	</tr>
            	</table>
            </td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><strong><%=RESOURCE.getString("VY_ID") %></strong> &nbsp;</div></td>
            <td width="30%"><input name="vyId" type="text" class="textBoxDashed" id="vyId" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("emp.EMPLOYEE_ID") %></div></td>
            <td width="30%"><input name="responsibilityid" type="text" class="textBoxDashed" id="responsibilityid" size="33" maxlength="15"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td><div align="right"><%=RESOURCE.getString("emp.EMPLOYEE_NAME") %></div></td>
            <td><input name="fullName" type="text" class="textBoxDashed" id="fullName" size="33" maxlength="100"></td>
            <td><div align="right"><%=RESOURCE.getString("emp.WORK_SCOPE") %></div></td>
            <td height="13" width="251"><input name="workScope" type="text" class="textBoxDashed" id="workScope" size="33" maxlength="200"></FONT></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td><div align="right"><%=RESOURCE.getString("emp.DESIGNATION") %></div></td>
            <td><input name="designationid" type="text" class="textBoxDashed" id="designationid" size="33" maxlength="20"></td>
            <td><div align="right"><%=RESOURCE.getString("emp.ROLE") %></div></td>
            <td><input name="roles" type="text" class="textBoxDashed" id="roles" size="33" maxlength="20"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td><div align="right"><%=RESOURCE.getString("emp.WORK_CITY") %></div></td>
            <td><input name="workCitycode" type="text" class="textBoxDashed" id="workCitycode" size="33" maxlength="20"></td>
            <td><div align="right"><%=RESOURCE.getString("emp.SANT_SAMAJ_ID") %></div></td>
            <td><input name="santSamajId" type="text" class="textBoxDashed" id="santSamajId" size="33" maxlength="255"></td>
          </tr>

          <tr bgcolor="#EBEBEB">
            <td><div align="right"><%=RESOURCE.getString("emp.ASHRAM_ID") %></div></td>
            <td><input name="ashramid" type="text" class="textBoxDashed" id="ashramid" size="33" maxlength="20"></td>
            <td><div align="right"><%=RESOURCE.getString("emp.START_DATE") %></div></td>
            <td><input name="startDate" type="text" class="textBoxDashed" id="startDate" size="33" maxlength="255"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td><div align="right"><%=RESOURCE.getString("emp.END_DATE") %></div></td>
            <td><input name="endDate" type="text" class="textBoxDashed" id="endDate" size="33" maxlength="20"></td>
            <td><div align="right"><%=RESOURCE.getString("emp.UPDATED_BY") %></div></td>
            <td><input name="lastUpdatedBy" type="text" class="textBoxDashed" id="lastUpdatedBy" size="33" maxlength="255"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td><div align="right"><%=RESOURCE.getString("emp.UPDATED_ON") %></div></td>
            <td><input name="lastUpdatedOn" type="text" class="textBoxDashed" id="lastUpdatedOn" size="33" maxlength="20"></td>
            <td><div align="right"></div></td>
            <td></td>
          </tr>
          
          <tr bgcolor="#F0E7DD">
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td colspan="4"><div align="center">
                <input type="reset" name="Clear" value="  <%=RESOURCE.getString("CLEAR") %>  " class="btn" />
              &nbsp;&nbsp;
                <input name="search" type="submit" value="<%=RESOURCE.getString("SEARCH") %>" class="btn"/></div></td>
          </tr>
        </table>
         </td>
      <td width="1%"></td>
    </tr>
    <tr>
      <td width="1%"></td>
    </tr>
  </table>
  
  <div class="abtn-cnt">
  <%
  	if(canAdd){
  		%><a href="./member.do?mode=ADD" name="add" class="abtn" title="Add Member"><%=RESOURCE.getString("ADD") %></a><%
  	}
	if(canDelete){
  		%><a href="javascript:;" id="adelete" name="adelete" class="abtn" title="Delete Member"><%=RESOURCE.getString("DELETE") %></a><%
  	}
  %>
  </div>
  <div class="rst-panel">  
  <table class="rst" cellpadding="0" cellspacing="0" width="100%" border="0">
  	<thead>
  		<tr>
  			<th><div class="hd"><%=RESOURCE.getString("SELECT") %></div></th>
  			<th><div class="hd"><%=EMPTY %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("VY_ID") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.EMPLOYEE_ID") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.EMPLOYEE_NAME") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.WORK_SCOPE") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.DESIGNATION") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.ROLE") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.WORK_CITY") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.SANT_SAMAJ_ID") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.ASHRAM_ID") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.START_DATE") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.END_DATE") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.UPDATED_BY") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("emp.UPDATED_ON") %></div></th>
  			
  		</tr>
  	</thead>
  	<tbody>
  <%
  	if(results != null && !results.isEmpty()){
  		int idx=0;
  		for(VyEmployeeDO rec : results){
  			%><tr><%
			if(canDelete){
				%><td><input type="checkbox" name="members" value="<%=rec.getVyId() %>" /></td> <%
			}else{
				%><td><%=EMPTY %></td><%
			}
			if(canEdit){
				%><td><a href="./member.do?mode=EDIT&ID=<%=rec.getVyId() %>" title="Edit" ><%=rec.getVyId() %></a></td><%
			}else{
				%><td><%=rec.getVyId() %></td><%
			}
			
			%>
			<td><%=rec.getVyId()!=null? rec.getVyId() : EMPTY %></td>
			<td><%=rec.getEmployeeId()!=null? rec.getEmployeeId() : EMPTY %></td>
			<td><%=rec.getFullName()!=null? rec.getFullName() : EMPTY %></td>
			<td><%=rec.getWorkScope()!=null? rec.getWorkScope(): EMPTY %></td>
			<td><%=rec.getDesignationId()!=null? rec.getDesignationId() : EMPTY %></td>
			<td><%=rec.getRolesResponsibility()!=null? rec.getRolesResponsibility() : EMPTY %></td>
			<td><%=rec.getWorkLocation()!=null? rec.getWorkLocation() : EMPTY %></td>
			<td><%=rec.getSantSamajId()!=null? rec.getSantSamajId() : EMPTY %></td>
			<td><%=rec.getAshramId()!=null? rec.getAshramId() : EMPTY %></td>
			<td><%=rec.getStartDate()!=null? rec.getStartDate() : EMPTY %></td>
			<td><%=rec.getEndDate()!=null? rec.getEndDate() : EMPTY %></td>
			<td><%=rec.getLastUpdatedBy()!=null? rec.getLastUpdatedBy() : EMPTY %></td>
			<td><%=rec.getLastUpdatedOn()!=null? rec.getLastUpdatedOn() : EMPTY %></td>
			</tr>
			<%
  		}
  	}else{
  		%><tr><td colspan="15"><%=RESOURCE.getString("NO_RECORDS") %></td></tr><%
  	}
  %>
  </tbody>
  </table>
 </div>
</form>
<script>

	LANG='<%=ActionCtx.ctx().getLang()%>';	
	function setLang(lang){
		LANG=lang;
		document.getElementById("mode").value="";
		document.getElementById("lang").value=lang;
		document.forms["mntnEmployeeForm"].submit();
	}
	
	addEvent('kruti','click',function(){ setLang('<%=AppConstants.Languages.KRUTI%>'); });
	addEvent('hindi','click',function(){ setLang('<%=AppConstants.Languages.HINDI%>'); });
	addEvent('english','click',function(){ setLang('<%=AppConstants.Languages.ENGLISH%>'); });
	
	attachKrutiEncoding("mntnEmployeeForm");


</script>
</body> 
</html>
     
      
    
